from tools import *

"""完成"""

while True:
    ResetTable()
    PrintTable()
    while True:
        char = InputOfCommand()
        if char in 'wW':
            MoveUp()
        elif char in 'aA':
            MoveLeft()
        elif char in 'sS':
            MoveDown()
        elif char in 'dD':
            MoveRight()
        elif char in 'rR':
            break
        elif char.lower() == 'exit':
            exit()
        AddNewNumber()
        PrintTable()
